import java.awt.Button;
import java.security.Policy.Parameters;
//import javax.security.auth.login.Configuration.Parameters;

class DirtyState {
    // Symbolic constants for events
    public static final int DIRTY_EVENT  = 1;
    public static final int APPLY_EVENT  = 2;
    public static final int SAVE_EVENT   = 3;
    public static final int REVERT_EVENT = 4;

    // Symbolic constants for states
    private static BothDirty  bothDirty;
    protected static FileDirty  fileDirty;
    protected static ParamDirty paramDirty;
    protected static NotDirty   notDirty;

    protected Parameters parameters;
    protected Button apply;
	protected Button save;
	protected Button revert;

    /**
     * Having this private constructor prevents classes outside
     * of this class from creating an instance of this class.
     */
    DirtyState() {
        if (bothDirty==null) { 
            bothDirty  = new BothDirty();
            fileDirty  = new FileDirty();
            paramDirty = new ParamDirty();
            notDirty   = new NotDirty();
        }  // if
    }  // constructor()

    public static DirtyState start(Parameters p,
            Button apply,
            Button save, 
            Button revert){
DirtyState d = new DirtyState();
d.parameters = p;
d.apply = apply;
d.save  = save;
d.revert= revert;
d.notDirty.enter();
return d.notDirty;
} // start(Button, Button, Button)

/**
* Respond to a given event with the next state.
* @param event An event code.
* @return the next state.
*/
protected DirtyState nextState(int event) { 
// This non-overridden method should never be called.
throw new IllegalAccessError();
}  // nextState(int)

/**
* Respond to the given event by determining the next
* current state and transitioning to it if it is a
* different state.
*/
public final DirtyState processEvent(int event) { 
DirtyState myNextState = nextState(event);
if (this!=myNextState) { 
myNextState.enter();
} // if
return myNextState;
} // processEvent(int)

/**
* This method is called when this object becomes the
* current state.
*/
protected void enter() {  } 


}
